<template>
	<view>
		<u-sticky bgColor="#6492FF" offsetTop=0 customNavHeight=0>
			<navbox title="提现记录"></navbox>
		</u-sticky>
		<view class="con" v-if="list.length>0">
			<view class="con__box__item" v-for="(item,index) in list" :key="index">
				<view class="u-flex u-flex-y-center u-flex-between">
					<view class="">
						余额提现
					</view>
					<view class="">
						{{item.price.toFixed(2)}}元
					</view>
				</view>
				<view class="u-flex u-flex-y-center u-flex-between">
					<view class="">
						{{item.buildTime}}
					</view>
					<view class="" v-if="item.status==0">
						提现中
					</view>
					<view class="" v-if="item.status==1">
						提现成功
					</view>
					<view class="" v-if="item.status==2">
						提现失败
					</view>
					<view class="" v-if="item.status==3">
						待审核
					</view>
				</view>
				<view class="u-flex u-flex-y-center u-flex-between" v-if="item.status==2">
					<view class="">
						{{item.failMsg}}
					</view>

				</view>
			</view>
			<u-loadmore @loadmore="loadmore" :status="morestatus" />
		</view>
		<view class="" v-else style="margin-top: 200rpx;">
			<u-empty icon="/static/img/index/empty.png" mode="data" text="暂时没有数据"></u-empty>
		</view>
	</view>
</template>

<script>
	import {
		txlist
	} from '@/api/user.js'
	export default {
		data() {
			return {
				pageSize: 10,
				pageNum: 1,
				list: [],
				morestatus: 'loadmore',
			};
		},
		onLoad() {
			// 查询提现账户
			this.getlist()
		},
		methods: {
			getlist() {
				txlist({
					pageSize: this.pageSize,
					pageNum: this.pageNum,
				}).then(res => {
					uni.stopPullDownRefresh()
					if (res.data.code == 200) {
						if (res.data.data.length == 0) {
							this.morestatus = 'nomore';
							return
						} else {
							this.morestatus = 'loadmore';
						}
						this.list = [...this.list, ...res.data.data]
					}
				})
			},
			loadmore() {
				if (this.morestatus == 'nomore') return
				this.morestatus = 'loading';
				this.pageNum = ++this.pageNum;
				this.getlist()
			}
		},
		onReachBottom() {
			this.loadmore()
		},
		onPullDownRefresh() {
			this.morestatus = 'loadmore'
			this.pageNum = 1
			this.list = []
			this.getlist()
		}
	}
</script>

<style lang="scss">
	.con {
		padding: 25rpx 40rpx;

		&__box {
			padding: 0 40rpx;
			background: #FFFFFF;
			border-radius: 14rpx;
			margin-bottom: 25rpx;

			&__top {
				padding: 34rpx 0 20rpx;
				border-bottom: 1rpx solid rgba(205, 205, 205, .5);

			}

			&__title {
				font-family: Source Han Sans SC;
				font-weight: 400;
				font-size: 34rpx;
				color: #3E3D3D;
				line-height: 34rpx;
			}

			&__inpbox {
				margin-top: 26rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				font-family: Source Han Sans SC;
				font-weight: 400;
				font-size: 26rpx;
				color: #3E3D3D;
				line-height: 26rpx;

				&__i {
					width: 80%;
					font-family: Source Han Sans SC;
					font-weight: 400;
					font-size: 26rpx;
					line-height: 26rpx;
					font-size: 26rpx;
					color: #707070;
				}
			}

			&__ye {
				display: flex;
				align-items: center;
				justify-content: space-between;
				font-family: Source Han Sans SC;
				font-weight: 400;
				font-size: 25rpx;
				color: #707070;
				line-height: 25rpx;
				margin: 24rpx 0;
			}

			&__tx {
				border-bottom: 1rpx solid rgba(205, 205, 205, .5);
				padding-bottom: 20rpx;
			}

			&__z {
				font-family: Source Han Sans SC;
				font-weight: 400;
				font-size: 26rpx;
				color: #707070;
				line-height: 26rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-top: 36rpx;
			}

			&__zh {
				font-family: Source Han Sans SC;
				font-weight: bold;
				font-size: 26rpx;
				color: #6492FF;
				line-height: 26rpx;
				margin-right: 10rpx;
			}

			&__more {
				width: 15rpx;
				height: 21rpx;
				margin-left: 6rpx;
			}

			&__footer {
				padding: 25rpx 58rpx 34rpx;
			}

			&__it {
				padding: 25rpx 0 25rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
			}

			&__gd {
				font-family: Source Han Sans SC;
				font-weight: 400;
				font-size: 25rpx;
				color: #707070;
				line-height: 25rpx;
			}

			&__item {
				padding: 25rpx 0;
				height: 66rpx;
				display: flex;
				flex-direction: column;
				justify-content: space-between;
				font-family: Source Han Sans SC;
				font-weight: 400;
				font-size: 26rpx;
				color: #3E3D3D;
				line-height: 26rpx;
				border-bottom: 1rpx solid rgba(112, 112, 112, .4);
			}
		}
	}
</style>